//
//  ViewController.m
//  segmented button
//
//  Created by iD Student on 7/10/13.
//  Copyright (c) 2013 iD Student. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(IBAction)segmentedAction:(id)sender
{
    UISegmentedControl *segmentButton = (UISegmentedControl *) sender;
    if(segmentButton.selectedSegmentIndex == 0)
    {
        label.text = @"ONE!";
        [self.view setBackgroundColor:[UIColor whiteColor]];

    }
    else if (segmentButton.selectedSegmentIndex == 1)
    {
        label.text = @"TWO!";
        [self.view setBackgroundColor:[UIColor whiteColor]];

    }
    else if (segmentButton.selectedSegmentIndex == 2)
    {
        [self.view setBackgroundColor:[UIColor redColor]];
        label.text = @"RED!";
    }
    else if (segmentButton.selectedSegmentIndex == 3)
    {
        [self.view setBackgroundColor:[UIColor blueColor]];
        label.text=@"Blue?";
    }
}
@end
